<?php

function delete_array_element($array , $i)
{
    $len =  count($array);
    for ($j= $i; $j<$len; $j ++){
        $array[$j] = $array [$j+1];
    }
    array_pop ($array);
    return $array ;
}

$arr = [1,2,3,4,5,6,7,8,9];

//unset($arr[2]);
$temp = delete_array_element($arr,2);